<?php
@include_once("toubu.php");
$username=$_GET["username"];
$userpwd = $_GET["userpwd"];
$sql="SELECT * FROM userinfo WHERE username = '$username' or usertel = '$username'";
$result=mysql_query($sql);//布尔值
$data=mysql_fetch_array($result);

  $obj = array();
  $obj["code"] ="0";
  $obj["msg"] = "用户名或密码错误";
//   echo json_encode($data);//集合
//   echo json_encode($data["0"]);//9
if($data["0"]>0){//用户存在
    // $obj["msg"]="用户存在";
    if($data["userpwd"]==$userpwd){
        $obj["code"]="1";
        $obj["id"]=$data["id"];
        $obj["msg"]="登录成功";
    }
}
echo json_encode($obj);